<template>
	<u-popup
		:closeOnClickOverlay="true"
		@close="closeTip"
		:show="true"
		bgColor="transparent"
		mode="center"
		round="10px"
	>
		<view class="tipPopup">
			<view class="content">
				<view class="title">{{ title }}</view>
				<view class="desc">{{ content }}</view>
				<view class="foot">
					<view class="cancel" v-if="showCancel" @click="closeTip"> 取消 </view>
					<view class="submit" @click="submitTip">{{ submitText }}</view>
				</view>
			</view>
			<img
				@click="closeTip"
				class="close"
				src="@/static/images/common/close.png"
				mode="scaleToFill"
			/>
		</view>
	</u-popup>
</template>

<script>
export default {
	name: 'TipPopup',
	props: {
		title: {
			type: String,
			default: '温馨提示',
		},
		content: {
			type: String,
			default: '您当前剩余5积分可用，是否立即与老板联系？',
		},
		submitText: {
			type: String,
			default: '去充值',
		},
		showCancel: {
			type: Boolean,
			default: false,
		},
	},
	methods: {
		closeTip() {
			this.$emit('closeTip');
		},
		submitTip() {
			this.$emit('submitTip');
		},
	},
};
</script>

<style scoped lang="scss">
.tipPopup {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	.content {
		width: 288px;
		min-height: 179px;
		background: #fff;
		border-radius: 10px;
		box-sizing: border-box;
		padding: 20px;
		.title {
			font-size: 18px;
			font-family: PingFang SC-Semibold, PingFang SC;
			font-weight: 600;
			color: #333333;
			text-align: center;
		}
		.desc {
			font-size: 14px;
			font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color: #666666;
			margin: 15px 18px;
			text-align: center;
		}
		.foot {
			display: flex;
			justify-content: space-around;
			.cancel {
				width: 40%;
				height: 40px;
				border-radius: 20px 20px 20px 20px;
				opacity: 1;
				font-size: 16px;
				font-family: PingFang SC-Semibold, PingFang SC;
				font-weight: 400;
				text-align: center;
				line-height: 40px;
				border: 1px solid #999;
				color: #999;
			}
			.submit {
				width: 40%;
				height: 40px;
				background: linear-gradient(90deg, #ffa222 0%, #ff8822 100%);
				border-radius: 20px 20px 20px 20px;
				opacity: 1;
				font-size: 16px;
				font-family: PingFang SC-Semibold, PingFang SC;
				font-weight: 600;
				color: #ffffff;
				text-align: center;
				line-height: 40px;
			}
		}
	}
	.close {
		width: 23px;
		height: 23px;
		margin: 10px auto;
	}
}
</style>
